﻿using AgencyManagerSystem.Model;
using System.Linq;

namespace AgencyManagerSystem.DataFetcher
{
    public class DimensionFetcher : BaseFetcher<DimensionModel>
    {
        public DimensionFetcher() : base()
        {

        }
        public DimensionModel GetByCode(string code)
        {
            Condition[] conditions = new Condition[] { new Condition() { Key = "Code", Op = "=", Value = code } };
            var list = List(conditions);
            if (list.Count > 0)
                return list.First();
            else
                return null;
        }

        public DimensionModel GetByLevel(int level)
        {
            Condition[] conditions = new Condition[] { new Condition() { Key = "Level", Op = "=", Value = level } };
            var list = List(conditions);
            if (list.Count > 0)
                return list.First();
            return null;
        }
    }
}